Skip to content

Conversation

gmilde
Copy link
Contributor

@gmilde gmilde commented Sep 9, 2025

The utility function sphinx.util.parsing.nested_parse_to_nodes() allows
nested parsing with support for sections.
This is a "power user" feature with known problems and usage restrictions.

Purpose

Inform the user about the risks and limitations when using nested_parse_to_nodes().

References

gmilde and others added 5 commits September 9, 2025 16:17
Set the "parent" attribute of RSTState instances to the `document`
instead of None.  The attribute holds the state machines "current node"
which is initialized to the `document` in `RSTStateMachine.run()` and
required since Docutils 0.22.1 in `RSTState.nested_parse()` to correctly
support sections in nested parsing.
"section" elements can only be children of "document" or "section"
elements, not "sidebar".
Cf. https://docutils.sourceforge.io/docs/ref/doctree.html#section
@gmilde
Copy link
Contributor Author

gmilde commented Oct 10, 2025

There is only one relevant, small commit in this branch.
All others are already in master or just merging master.

Shoud/May I rebase the "gmilde:comment" branch on "master" to get rid of the »spurious« commits?

@timhoffm
Copy link
Contributor

I'd say yes.

The general policy of sphinx is to not alter the commit history in a PR, so that incremental reviews are possible and reviewers can just continue from the last point they looked at. But the overall goal is to ease review, and in this case, I think a single commit with the relevant change is easier to review.

@gmilde gmilde closed this Oct 10, 2025
@gmilde gmilde deleted the comment branch October 10, 2025 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible data loss with sphinx.util.parsing.nested_parse_to_nodes() misleading docstring for sphinx.util.parsing.nested_parse_to_nodes()

3 participants